<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title>用户详情页面</title>
<%@include file="/WEB-INF/base.jspf"%>
 
<style>
	.modal-dialog {
		max-width: 1000px;
	}

.layui-inline {
	height: 100px;
}

.hidden-c{
	display: none;
}

#hymc {
	margin: 2px;
	height: 37px;
}
.btn-control-startOrBan {
	transition: background-color 0.3s;
}
.modal-body > p{
	display:flex;
	align-items:center;
	margin-right:16px;
	margin-bottom:16px;
}
.modal-body {
	display:flex;
	flex-wrap:wrap;
}
.modal-body > p > span {
	width:130px;
}
.modal-body > p > .form-control {
	width:250px;
}
table th,table tr,table td {
text-align: center;
vertical-align:middle;
}
#notice-text, .yue-addNewAccount-input {
	display: hidden;
}
#notice-text.active, .yue-addNewAccount-input.active {
	display: block;
}

.header{
	margin-bottom: 40px;
}

body{
	margin: 10px 20px;
}

.butt-xiangqing {
    color: #fff;
    background-color: #009688;
    border-color: #009688;
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}

</style>
	</head>
	<body>
	
			<div class='wapper'>
				<div class="" style="padding:16px 0;display:flex;align-items:center;justify-content:space-between;margin-left: 40%;">
					<div style="display:flex;align-items:center;">
						<input style="display:none;" id="namehuiy" value="${user.name }"/>
						<button class="layui-btn layui-btn-radius" id="id-searchTableBtn1">用户名：${user.name }</button>
						<button class="layui-btn layui-btn-radius" id="id-resetTableBtn1">余额：${user.balance }</button> 
					</div>
				</div>
				<div class="header">
					<th><button class='btn btn-info btn-edit-UserInfo bnt-huiyzl'>会员资料</button></th>
					<th><button class='btn btn-info btn-edit-UserInfo bnt-zhanghulius'>账户流水</button></th>
					<th><button class='btn btn-info btn-edit-UserInfo bnt-tozjl'>投注记录</button></th>
					<th><button class='btn btn-info btn-edit-UserInfo bnt-czhijilu'>充值记录</button></th>
					<th><button class='btn btn-info btn-edit-UserInfo bnt-drawjilu'>提现记录</button></th>
					<th><button class='btn btn-info btn-edit-UserInfo bnt-damjl'>打码记录</button></th>
					<th><button class='btn btn-info btn-edit-UserInfo bnt-dailfdian'>代理返点记录</button></th>
					<th><button class='btn btn-info btn-edit-UserInfo bnt-xiajiyhu'>下级用户</button></th>
			  </div>
				
				
				<div class='content'>
				<div id='div-yhztxx'>
					<div class="modal-body">
		            	<p><span>会员账号:</span><input class="form-control" id="input-i-id1" readonly  value="${user.name }"/></p>
		            	<p><span>余额：</span><input class="form-control input-c-canEdit" id="input-i-balance1" readonly value="${user.balance }" /></p>
		            	<p><span>创建时间：</span><input class="form-control" id="input-i-createtime1" readonly value="${user.createtime }"/></p>
		            	<p><span>上级代理：</span><input class="form-control" id="input-i-dailimingchen1" readonly value="${user.fid }"/></p>
		            	<p><span>代理连接：</span><input class="form-control" id="input-i-icode1" readonly value="${user.icode }" /></p>
		            	<p><span>最后登录ip：</span><input class="form-control" id="input-i-lastIp1" readonly value="${user.lastIp }"/></p>
		            	<p><span>最后登录时间：</span><input class="form-control" id="input-i-lastTime1" readonly value="${user.lastTime }"/></p>
		            	<p><span>代理金额：</span><input class="form-control input-c-canEdit" id="input-i-money1" readonly value="${user.money }"/></p>
		            	<p><span>最近未登录时间：</span><input class="form-control" id="input-i-notTime1" readonly value="${ user.lastTime}"/></p>
		            	<p><span>QQ号：</span><input class="form-control" id="input-i-qq1" readonly value="${user.qq }"/></p>
		            	<p><span>注册ip：</span><input class="form-control" id="input-i-registerIp1" readonly value="${user.registerIp }"/></p>
		            	<p><span>下级用户：</span><input class="form-control" id="input-i-registerIp2" readonly value="下级用户" type="button"/></p>
	            	</div>
            	</div>
            	
            	<table class="class-tableDataTable class-table-needClick display table table-striped table-bordered table-hover" id="hyzb">
			<thead>
				<tr>
					<th>变动类型</th>
					<th>订单号</th>
					<th>变动前金额</th>
					<th>变动金额</th>
					<th>变动后金额</th>
					<th>变动时间</th>
					<th>操作人员</th>
					<th>备注</th>
				</tr>
			</thead>
			 <tbody id="datashuju">
			 
			</tbody> 
		</table>
				
				
		<table class="class-tableDataTable class-table-needClick display table table-striped table-bordered table-hover" id="hyzb1">
				<thead>
						<tr>
							<th style="display:none;"></th>
							<th>彩种名称</th>
							<th>期号</th>
							<th>投注时间</th>
							<th>注数</th>
							<th>投注金额</th>
							<th>中奖金额</th> 
							<th>状态</th> 
							<th>投注详情</th> 
						</tr>
					</thead>
			 <tbody id="datashuju3">
			 
			</tbody> 
		</table>
		
		<table id="table-i-dailiList"  class="class-tableDataTable class-table-needClick display table table-striped table-bordered table-hover" >
			<thead>
				<tr>
					<th>消费金额</th>
					<th>返点类型</th>
					<th>订单号</th>
					<th>代理等级</th>
					<th>返点率</th>
					<th>返点金额</th>
					<th>代理名称</th>
					<th>创建时间</th>
				</tr>
			</thead>
			<tbody>
					
			</tbody>
		</table>
				
				
		<table class="class-tableDataTable class-table-needClick display table table-striped table-bordered table-hover" id="table-i-userList">
			<thead>
				<tr>
					<th style="display:none;"></th>
					<th>代理名称</th>
					<th>代理余额</th>
					<th>手机号码</th>
					<th>登录地址</th>
					<th>登录时间</th>
					<th>用户操作</th>
				</tr>
			</thead>
			 <tbody> </tbody> 
		</table>
		
		<table class="class-tableDataTable class-table-needClick display table table-striped table-bordered table-hover" id="khczjl" >
					<thead>
						<tr>
							<th style="hidden-c"></th>
							<th style="hidden-c"></th>
							<!-- <th>会员名</th> -->
							<th>存款户名</th>
							<th>支付平台</th>
							<th>充值操作</th>
							<th>存款方式</th>
							<th>存款金额</th>
							<th>存款账号</th>
							<th>充值类型</th>
							<th>充值状态</th>
							<th>平台收款姓名</th>
							<th>平台收款账号</th>							
							<th>申请时间</th>
							<th>处理时间</th>
							<th>操作人员</th>
							<th>备注</th>
						</tr>
					</thead>
				</table>
		
		<table class="class-tableDataTable class-table-needClick display table table-striped table-bordered table-hover" id="khtkjl" >
					<thead>
						<tr>
							<th class="hidden-c"></th>
							<th class="hidden-c"></th>
							<th class="hidden-c"></th>
							<th>提款操作</th>
							<th>提款户名</th>
							<th>提款账号</th>
							<th>提款金额</th>
							<th>提款银行</th>
							<th>申请时间</th>
							<th>处理时间</th>
							<th>提款类型</th>							
							<th>提款状态</th>
							<th>操作人员</th>
							<th>备注</th>
						</tr>
					</thead>
				</table>
		
		<div>
				<table class="class-tableDataTable class-table-needClick display table table-striped table-bordered table-hover" id="damajl" >
					<thead>
						<tr>
							<th>变动类型</th>
							<th>变动前打码量</th>
							<th>变动打码量</th>
							<th>变动后打码量</th>
							<th>变动时间</th>
							<th>变动前提款所需</th>
							<th>变动提款所需</th>
							<th>变动后提款所需</th>
							<th>操作员</th>
							<th>备注</th>
						</tr>
					</thead>
					<tbody>
					</tbody>
				</table>
			</div>
            	
		</div>
		</div>
		
		
		
		
			<div class="modal fade" id="addAndEditModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:1000px!important;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            </div>
            <div class="modal-body">
            	<p><span >投注账号:</span><input class="form-control" id="input-i-id" readonly /></p>
            	<p ><span >彩种名称：</span><input class="form-control input-c-canEdit" id="input-i-balance" readonly /></p>
            	<p ><span>期号：</span><input class="form-control" id="input-i-createtime" readonly /></p>
            	<p ><span>投注时间：</span><input class="form-control" id="input-i-dailimingchen" readonly /></p>
            	<p ><span>注数：</span><input class="form-control" id="input-i-icode" readonly /></p>
            	<p ><span>投注金额：</span><input class="form-control" id="input-i-lastIp" readonly /></p>
            	<p><span>中奖金额：</span><input class="form-control" id="input-i-lastTime" readonly /></p>
            	<p><span>状态：</span><input class="form-control input-c-canEdit" id="input-i-money" readonly /></p>
            	<p><span>投注玩法：</span><input class="form-control" id="input-i-name" readonly /></p>
            	<p><span>投注号码：</span><input class="form-control" id="input-i-nicheng" readonly /></p>
            </div>
            <div class="modal-footer" style="text-align: center;">
                <button type="button" class="btn btn-default btn-lg" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>	
<script type="text/javascript" src="/js/zhengzeTools.js"></script>
	<script>
		$(".class-tableDataTable").hide(); 
	 	$(".header button").on("click",function(){
			$(".dataTables_wrapper").hide();   //点击前关掉其他的dataTable。
			if($(this).hasClass("bnt-huiyzl")){
				$("#div-yhztxx").show();
			}else{
				$("#div-yhztxx").hide();
				if($(this).hasClass("bnt-zhanghulius")){
					$("#hyzb").show();
				}if($(this).hasClass("bnt-tozjl")){
					$("#hyzb1").show();
				}if($(this).hasClass("bnt-czhijilu")){
					$("#khczjl").show();
				}if($(this).hasClass("bnt-drawjilu")){
					$("#khtkjl").show();
				}if($(this).hasClass("bnt-damjl")){
					$("#damajl").show();
				}if($(this).hasClass("bnt-dailfdian")){
					$("#table-i-dailiList").show();
				}if($(this).hasClass("bnt-xiajiyhu")){
					$("#table-i-userList").show();
				}
			}
		}) 
	
		/* $(".bnt-huiyzl").on("click",function(){
			$("#div-yhztxx").show();
		})	 */
		//账户流水
		$(".bnt-zhanghulius").on("click",function(){
				var oTable=	$("#hyzb").DataTable({
						"bProcessing" : false, // 是否显示取数据时的那个等待提示
						"bServerSide" : true,//这个用来指明是通过服务端来取数据
						 "bPaginate" : true, //是否显示分页 
						"sAjaxSource" : "/zhgl/likeFindUserWaterRecord.do",//这个是请求的地址
						"fnServerData" : retrieveData, // 获取数据的处理函数
						"destroy":true,
					      // "bPaginate": true,
					       "bLengthChange": true,      
					      "bSort": false,
					      // "bInfo": true,
					      "bAutoWidth": false,
//					         "bServerSide":true,
					      'aLengthMenu':[5,10, 20], 
					       "searching": false,  
					       "pagingType": "simple_numbers",
					       "dom": "t<'tableinfo'i<'tableSearch'p>l>",  
					       
					       "language": {//语言设置  
					            "lengthMenu": "每页显示 _MENU_ 条记录",     
					            "zeroRecords": "没有检索到数据",     
					            "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
					            "info": "没有数据",     
					            "oPaginate": {     
					                "sFirst": "首页",     
					                "sPrevious": "前一页",     
					                "sNext": "后一页",     
					                "sLast": "尾页"    
					          	},
					            "search":"",
					            "searchPlaceholder": "请输入关键字",
					            "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
					            "infoEmpty":      "没有找到匹配的信息",
					         },  
					         "columnDefs": [{"defaultContent": "",
	                              "targets": "_all"}],
                             "columns": [
    		                     { "data": "bdtype" },
    		                     { "data": "ordernum" },
    		                     { "data": "bdqjine" },
    		                     { "data": "bdjine" },
    		                     { "data": "bdhjine" },
    		                     { "data": "createtime" },
    		                     { "data": "czname" },
    		                     { "data": "beizhu" }
    		                 ],	 
				})
				

	function retrieveData(sSource, aoData, fnCallback) {
				$.ajax({
					url : sSource,//这个就是请求地址对应sAjaxSource
					data : {
						"pageCount":aoData[0].value,
						"startIndex":aoData[3].value,
						"lineCount":aoData[4].value,
						"date1" : "",
		    	        "date2" : "",
		    	        "bdtype" : "",
		    	        "ordernum" :"",
		    	        "huiyuanzh": $('#namehuiy').val(),
		    	        "daili": "",
						
					},//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
					type : 'post',
					dataType : 'json',
					async : false,
					 
					success : function(result) { 
						fnCallback(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
					},
					error : function(msg) {
					}
				});
			}
		})	
		
		//投注记录		
		$(".bnt-tozjl").on("click",function(){
			var oTable=	$("#hyzb1").DataTable({
				"bProcessing" : false, // 是否显示取数据时的那个等待提示
				"bServerSide" : true,//这个用来指明是通过服务端来取数据
				 "bPaginate" : true, //是否显示分页 
				"sAjaxSource" : "/czgl/findUserBettingRecord.do",//这个是请求的地址
				"fnServerData" : retrieveData, // 获取数据的处理函数
				"destroy":true,
			      // "bPaginate": true,
			       "bLengthChange": true,      
			      "bSort": false,
			      // "bInfo": true,
			      "bAutoWidth": false,
//			         "bServerSide":true,
			      'aLengthMenu':[5,10, 20], 
			       "searching": false,  
			       "pagingType": "simple_numbers",
			       "dom": "t<'tableinfo'i<'tableSearch'p>l>",  
			       
			       "language": {//语言设置  
			            "lengthMenu": "每页显示 _MENU_ 条记录",     
			            "zeroRecords": "没有检索到数据",     
			            "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
			            "info": "没有数据",     
			            "oPaginate": {     
			                "sFirst": "首页",     
			                "sPrevious": "前一页",     
			                "sNext": "后一页",     
			                "sLast": "尾页"    
			          	},
			            "search":"",
			            "searchPlaceholder": "请输入关键字",
			            "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
			            "infoEmpty":      "没有找到匹配的信息",
			         },  
			         "columnDefs": [{"defaultContent": "",
                          "targets": "_all"}],
			        "aoColumns": [
			        	 {"data": "id", "className": "id-td-edit hidden-td"},
						 {"data": "cname1", "className": "yid-td1"},
	                     {"data": "period", "className": "sex-td"},
	                     {"data": "orderdate", "className": "njob-td timedate"},
	                     {"data": "lottercount", "className": "njob-td"},
	                     {"data": "acount", "className": "njob-td"},
	                     {"data": "goalmoney", "className": "njob-td"},
	                     {"data": "states", "className": "njob-td"},
	                     {"data": null, "defaultContent": "<button class='butt-xiangqing'>投注详情</button>"},
	                 ], 
			})
			function retrieveData(sSource, aoData, fnCallback){
				$.ajax({
					url : sSource,//这个就是请求地址对应sAjaxSource
					data : {
						"pageCount":aoData[0].value,
						"startIndex":aoData[3].value,
						"lineCount":aoData[4].value,
						 "cname1":/* caizhong */"",
						 "period":/* $("#hymc-touzhuqihao").val() */"",
						 "date1":/* $("#test1").val() */"",
						 "huiyuanzh":/* $("#hymc-huiyuanzhanghao").val() */ $('#namehuiy').val(),
						 "state":/* $("#qblx-quanbuleixing").val() */"",
					},//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
					type : 'post',
					dataType : 'json',
					async : false,
					success : function(result) { 
						 var newData = result.aaData
		        		for (var i = 0; i < newData.length; i++) {
		        			var item = newData[i]
		        			if (item.state === 1) {
		        				item.states = "待开奖"
		        			}
		        			else if(item.state === 7) {
		        				item.states = "已撤单"
		        			}else if(item.state === 8){
		        				item.states = "平台退款"
		        			}
		        			else if(item.state === 6) {
		        				item.states = "和局中奖"
		        			}
		        			else if(item.state === 2 || item.goalmoney === 0.00) {
		        				item.states = "未中奖"
		        			}
		        			else if(item.state === 3 || item.goalmoney !== 0.00) {
		        				item.states = "已中奖"
		        			}
		        		}
						result.aaData = newData;
						fnCallback(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
					},
					error : function(msg) {
					}
				});
			} 
		})
		
		//投注详情
		$("#hyzb1").on("click",'.butt-xiangqing',function(e){
				$("#addAndEditModal").modal("show")
				var id = $(e.currentTarget).closest("tr").find(".id-td-edit").text()
				var date1 = $(e.currentTarget).closest("tr").find(".timedate").text()
				$.ajax({
					type: "post",
					url: "/czgl/touzhuRecord.do",
					"data":{'id':id	},
					success:function(data){
					var r = data.data
					var body = $("#addAndEditModal .modal-body")
					body.empty()
					var awardNumber  =r.lotternum
					if(awardNumber  == null || awardNumber  == "" ){
						awardNumber   = "待开奖"
					}
					body.append("<p><span class='backbet'>投注期号：</span><input value='"+r.period+"'class='form-control backCor' id='input-i-name' readonly /></p><p><span class='backbet'>开奖号码：</span><input value='"+awardNumber+"' class='form-control backCor' id='input-i-nicheng' readonly /></p>") 
					if(r.str1!=''&& r.str1!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay1+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str1+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					if(r.str2!=''&& r.str2!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay2+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str2+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					if(r.str3!=''&& r.str3!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay3+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str3+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str4!=''&& r.str4!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay4+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str4+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str5!=''&& r.str5!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay5+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str5+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str6!=''&& r.str6!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay6+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str6+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str7!=''&& r.str7!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay7+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str7+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str8!=''&& r.str8!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay8+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str8+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str9!=''&& r.str9!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay9+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str9+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str10!=''&& r.str10!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay10+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str10+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str11!=''&& r.str11!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay11+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str11+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str12!=''&& r.str12!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay12+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str12+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str13!=''&& r.str13!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay13+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str13+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str14!=''&& r.str14!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay14+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str14+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str15!=''&& r.str15!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay15+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str15+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str16!=''&& r.str16!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay16+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str16+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str17!=''&& r.str17!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay17+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str17+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str18!=''&& r.str18!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay18+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str18+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str19!=''&& r.str19!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay19+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str19+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str20!=''&& r.str20!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay20+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str20+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str21!=''&& r.str21!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay21+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str21+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str22!=''&& r.str22!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay22+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str22+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str23!=''&& r.str23!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay23+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str23+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str24!=''&& r.str24!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay24+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str24+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str25!=''&& r.str25!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay25+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str25+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str26!=''&& r.str26!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay26+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str26+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str27!=''&& r.str27!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay27+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str27+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str28!=''&& r.str28!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay28+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str28+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str29!=''&& r.str29!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay29+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str29+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str30!=''&& r.str30!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay30+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str30+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str31!=''&& r.str31!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay31+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str31+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str32!=''&& r.str32!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay32+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str32+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str33!=''&& r.str33!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay33+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str33+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str34!=''&& r.str34!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay34+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str34+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					
					if(r.str35!=''&& r.str35!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay35+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str35+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					if(r.str36!=''&& r.str36!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay36+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str36+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					if(r.str37!=''&& r.str37!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay37+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str37+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					if(r.str38!=''&& r.str38!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay38+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str38+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					if(r.str39!=''&& r.str39!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay39+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str39+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					if(r.str40!=''&& r.str40!=null){
						body.append("<p><span>投注玩法：</span><input value='"+r.cplay40+"' class='form-control' id='input-i-name' readonly /></p><p><span>投注号码：</span><input value='"+r.str40+"' class='form-control' id='input-i-nicheng' readonly /></p>")
					} 
					}
				});
			}) 
			
			//充值记录
			$(".bnt-czhijilu").on("click",function(){
				var oTable=	$("#khczjl").DataTable({
					 "bProcessing" : false, // 是否显示取数据时的那个等待提示
					"bServerSide" : true,//这个用来指明是通过服务端来取数据
					 "bPaginate" : true, //是否显示分页 
					"sAjaxSource" : "/zhgl/likeFindRechageRecord.do",//这个是请求的地址
					"fnServerData" : retrieveData, // 获取数据的处理函数
					"destroy":true,
				      // "bPaginate": true,
				       "bLengthChange": true,      
				      "bSort": false,
				      // "bInfo": true,
				      "bAutoWidth": false,
//				         "bServerSide":true,
				      'aLengthMenu':[5,10, 20], 
				       "searching": false,  
				       "pagingType": "simple_numbers",
				       "dom": "t<'tableinfo'i<'tableSearch'p>l>",  
				       
				       "language": {//语言设置  
				            "lengthMenu": "每页显示 _MENU_ 条记录",     
				            "zeroRecords": "没有检索到数据",     
				            "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
				            "info": "没有数据",     
				            "oPaginate": {     
				                "sFirst": "首页",     
				                "sPrevious": "前一页",     
				                "sNext": "后一页",     
				                "sLast": "尾页"    
				          	},
				            "search":"",
				            "searchPlaceholder": "请输入关键字",
				            "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
				            "infoEmpty":      "没有找到匹配的信息",
				         },  
				         "columnDefs": [{"defaultContent": "",
                             "targets": "_all"}],
				         "columns": [
				        	 { "data": "id", "className": "id-td hidden-c" },
							 { "data": "userid", "className": "userid-td hidden-c" },	
		                    /*  { "data": "name", "className": "userAccount-td" }, */
		                     { "data": "ckname", "className": "cunkuanperson-td"   },
		                     { "data": "zhifupt", "className": "zhifupt-td"  },
		                     { "data": "caozuo" },
		                     { "data": "hydengji", "className": "zhuanzhangway-td"},
		                     { "data": "fukuanje", "className": "zhuanzhangjine-td" },
		                     { "data": "zhifuzh", "className": "zhuanzhangrenAccount-td" },
		                     { "data": "type", "className": "isJiaKuan-td" },
		                     { "data": "state" },
							 { "data": "skname", "className": "skname-td" },
							 { "data": "skbankzh", "className": "skbankzh-td" },		                     
		                     { "data": "sqtime", "className": "qukuanTime-td" },
		                     { "data": "cltime" },
		                     { "data": "czname" },
		                     { "data": "beizhu", "className": "beizhu-td" }
		                 ],	
				})
	function retrieveData(sSource, aoData, fnCallback) {
				$.ajax({
					url : sSource,//这个就是请求地址对应sAjaxSource
					data : {
						"pageCount":aoData[0].value,
						"startIndex":aoData[3].value,
						"lineCount":aoData[4].value,
						"name": $('#namehuiy').val(),
						  "date1" :"",
		    	        "date2" : "",
		    	        "type" :"",
		    	        "state" :"",
		    	        "daili" : "", 
					},//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
					type : 'post',
					dataType : 'json',
					async : false,
					success : function(result) { 
						var newJson = result.aaData
		        		 for (var i = 0; i < newJson.length; i++) {
		         			 var item = newJson[i]
		         			if (item.caozuo == "锁定" || item.caozuo=="取消锁定") {
		         				 item.caozuo="处理中"
		         			 }
		        		 }
						/* result.aaData = newJson; */
						fnCallback(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
						
					},
					error : function(msg) {
					}
				});
			}
			})
			
			//提现记录
			$(".bnt-drawjilu").on("click",function(){
				var oTable=	$("#khtkjl").DataTable({
					 "bProcessing" : false, // 是否显示取数据时的那个等待提示
					"bServerSide" : true,//这个用来指明是通过服务端来取数据
					 "bPaginate" : true, //是否显示分页 
					"sAjaxSource" : "/zhgl/likeFindUserDrawingRecord.do",//这个是请求的地址
					"fnServerData" : retrieveData, // 获取数据的处理函数
					"destroy":true,
				      // "bPaginate": true,
				       "bLengthChange": true,      
				      "bSort": false,
				      // "bInfo": true,
				      "bAutoWidth": false,
//				         "bServerSide":true,
				      'aLengthMenu':[5,10, 20], 
				       "searching": false,  
				        "pagingType": "simple_numbers",
				       "dom": "t<'tableinfo'i<'tableSearch'p>l>", 
				       
				       "language": {//语言设置  
				            "lengthMenu": "每页显示 _MENU_ 条记录",     
				            "zeroRecords": "没有检索到数据",     
				            "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
				            "info": "没有数据",     
				            "oPaginate": {     
				                "sFirst": "首页",     
				                "sPrevious": "前一页",     
				                "sNext": "后一页",     
				                "sLast": "尾页"    
				          	},
				            "search":"",
				            "searchPlaceholder": "请输入关键字",
				            "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
				            "infoEmpty":      "没有找到匹配的信息",
				         },  
				         "columnDefs": [{"defaultContent": "",
                            "targets": "_all"}],
				         "columns": [
				        	 {"data": "id", "className": "hidden-c id-td"},
		                     {"data": "userid", "className": "hidden-c user-td"},
		                    {"data": "tikuansxf", "className": "hidden-c tikuansxf-td"},
		                     { "data": "caozuo" },
		                     { "data": "skname", "className" : "shoukuanhuming-td"},
		                     { "data": "skbankzh", "className" : "bankaccount-td" },
		                     { "data": "tikuanje", "className": "shenqingjine-td" },
		                     { "data": "zhifupt", "className" : "bankType-td"},
		                     { "data": "sqtime", "className" : "qukuanTime-td" },
		                     { "data": "cltime" },
		                     { "data": "type",   "className" : "tikuanleixing-td" },
		                     { "data": "state" },
		                     { "data": "czname" },
		                     { "data": "beizhu", "className": "beizhu-td" },
		                 ],	
				})
	function retrieveData(sSource, aoData, fnCallback) {
				$.ajax({
					url : sSource,//这个就是请求地址对应sAjaxSource
					data : {
						"pageCount":aoData[0].value,
						"startIndex":aoData[3].value,
						"lineCount":aoData[4].value,
						  "date1" : "",
		    	        "date2" :"",
		    	        "type" :"",
		    	        "state" : "",
		    	        "name" :$('#namehuiy').val(),
		    	        "daili" :"", 
					},//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
					type : 'post',
					dataType : 'json',
					async : false,
					 
					success : function(result) { 
						var newJson = result.aaData
		        		 for (var i = 0; i < newJson.length; i++) {
		         			 var item = newJson[i]
		         			 console.log(item.tikuansxf)
		         			 if (item.caozuo == "锁定" || item.caozuo=="取消锁定") {
		         				item.caozuo="处理中"     				 
		         			 }
		        		 }
						result.aaData = newJson;
						fnCallback(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
					},
					error : function(msg) {
					}
				});
			}
			})
			
			
			
			
			//打码记录
			$(".bnt-damjl").on("click",function(){
				var oTable=	$("#damajl").DataTable({
					 "bProcessing" : false, // 是否显示取数据时的那个等待提示
					"bServerSide" : true,//这个用来指明是通过服务端来取数据
					 "bPaginate" : true, //是否显示分页 
					"sAjaxSource" : "/zhgl/likeFindUserCodeRecord.do",//这个是请求的地址
					"fnServerData" : retrieveData, // 获取数据的处理函数
					"destroy":true,
				      // "bPaginate": true,
				       "bLengthChange": true,      
				      "bSort": false,
				      // "bInfo": true,
				      "bAutoWidth": false,
//				         "bServerSide":true,
				      'aLengthMenu':[5,10, 20], 
				       "searching": false,  
				        "pagingType": "simple_numbers",
				       "dom": "t<'tableinfo'i<'tableSearch'p>l>", 
				       
				       "language": {//语言设置  
				            "lengthMenu": "每页显示 _MENU_ 条记录",     
				            "zeroRecords": "没有检索到数据",     
				            "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
				            "info": "没有数据",     
				            "oPaginate": {     
				                "sFirst": "首页",     
				                "sPrevious": "前一页",     
				                "sNext": "后一页",     
				                "sLast": "尾页"    
				          	},
				            "search":"",
				            "searchPlaceholder": "请输入关键字",
				            "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
				            "infoEmpty":      "没有找到匹配的信息",
				         },  
				         "columnDefs": [{"defaultContent": "",
                             "targets": "_all"}],
                             "columns": [
			                     { "data": "bdtype" },
			                     { "data": "bdqcount" },
			                     { "data": "bdcount" },
			                     { "data": "bdhcount" },
			                     { "data": "createtime" },
			                     { "data": "bdqtksx" },
			                     { "data": "bdtksx" },
			                     { "data": "bdhtksx" },
			                     { "data": "czname" },
			                     { "data": "beizhu" }
			                 ],	 
				})
	function retrieveData(sSource, aoData, fnCallback) {
				$.ajax({
					url : sSource,//这个就是请求地址对应sAjaxSource
					data : {
						"pageCount":aoData[0].value,
						"startIndex":aoData[3].value,
						"lineCount":aoData[4].value,
						"date1":"" ,
						"date2": "" ,
						"bdtype": "" ,
						"huiyuanzh":$('#namehuiy').val(), 
					},//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
					type : 'post',
					dataType : 'json',
					async : false,
					 
					success : function(result) { 
						fnCallback(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
					},
					error : function(msg) {
					}
				});
			}
			})
			
			
			
			//用户返点记录
			$(".bnt-dailfdian").on("click",function(){
				var oTable=	$("#table-i-dailiList").DataTable({
					 "bProcessing" : false, // 是否显示取数据时的那个等待提示
					"bServerSide" : true,//这个用来指明是通过服务端来取数据
					 "bPaginate" : true, //是否显示分页 
					"sAjaxSource" : "/agents/findAgentRecord.do",//这个是请求的地址
					"fnServerData" : retrieveData, // 获取数据的处理函数
					"destroy":true,
				      // "bPaginate": true,
				       "bLengthChange": true,      
				      "bSort": false,
				      "dom": "t<'tableinfo'i<'tableSearch'p>l>", 
				      // "bInfo": true,
				      "bAutoWidth": false,
//				         "bServerSide":true,
				      'aLengthMenu':[5,10, 20], 
				       "searching": false,  
				       "pagingType": "simple_numbers",
				       "language": {//语言设置  
				            "lengthMenu": "每页显示 _MENU_ 条记录",     
				            "zeroRecords": "没有检索到数据",     
				            "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
				            "info": "没有数据",     
				            "oPaginate": {     
				                "sFirst": "首页",     
				                "sPrevious": "前一页",     
				                "sNext": "后一页",     
				                "sLast": "尾页"    
				          	},
				            "search":"",
				            "searchPlaceholder": "请输入关键字",
				            "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
				            "infoEmpty":      "没有找到匹配的信息",
				         },  
				         "columnDefs": [{"defaultContent": "",
	                          "targets": "_all"}],
	                          "columns": [
				                     { "data": "consume" ,"className": "consume-td"},
				                     { "data": "rebate_type","className": "rebate_type-td"},
				                     { "data": "order_number","className": "order_number-td" },
				                     { "data": "agent_grade","className": "agent_grade-td"},
				                     { "data": "rebate_ratio","className": "rebate_ratio-td" },
				                     { "data": "rebate_money" ,"className": "rebate_money-td"},
				                     { "data": "agent_name","className": "agent_name-td" },
				                     { "data": "created_time","className": "created_time-td" },
				                 ],	 
				})
	function retrieveData(sSource, aoData, fnCallback) {
				$.ajax({
					url : sSource,//这个就是请求地址对应sAjaxSource
					data : {
						"pageCount":aoData[0].value,
						"startIndex":aoData[3].value,
						"lineCount":aoData[4].value,
						 "startDate":"",
						"endDate":"",
						"userName":$('#namehuiy').val(),
						"agentName":"", 
					},//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
					type : 'post',
					dataType : 'json',
					async : false,
					 
					success : function(result) { 
						var newData=result.aaData;
						 for(i=0;i<newData.length;i++){
							 item=newData[i];
							 item.agent_grade= item.agent_grade+"级";
							 if(item.rebate_type==1){
								 item.rebate_type="充值返点" 
							 }
							 if(item.rebate_type==2){
								 item.rebate_type="打码返点" 
							 } 	
						 }
						fnCallback(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
					},
					error : function(msg) {
					}
				});
			}
			})
			
			//代理下级用户
			$(".bnt-xiajiyhu").on("click",function(){
				var oTable=	$("#table-i-userList").DataTable({
					"bProcessing" : false, // 是否显示取数据时的那个等待提示
					"bServerSide" : true,//这个用来指明是通过服务端来取数据
					 "bPaginate" : true, //是否显示分页 
					"sAjaxSource" : "/agents/findAllAgents.do",//这个是请求的地址
					"fnServerData" : retrieveData, // 获取数据的处理函数
					"destroy":true,
				      // "bPaginate": true,
				       "bLengthChange": true,      
				      "bSort": false,
				      "dom": "t<'tableinfo'i<'tableSearch'p>l>", 
				      // "bInfo": true,
				      "bAutoWidth": false,
//				         "bServerSide":true,
				      'aLengthMenu':[5,10, 20], 
				       "searching": false,  
				       "pagingType": "simple_numbers",
				       "language": {//语言设置  
				            "lengthMenu": "每页显示 _MENU_ 条记录",     
				            "zeroRecords": "没有检索到数据",     
				            "sInfo": "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录",     
				            "info": "没有数据",     
				            "oPaginate": {     
				                "sFirst": "首页",     
				                "sPrevious": "前一页",     
				                "sNext": "后一页",     
				                "sLast": "尾页"    
				          	},
				            "search":"",
				            "searchPlaceholder": "请输入关键字",
				            "infoFiltered":   "(从  _MAX_ 记录中搜索出结果)",
				            "infoEmpty":      "没有找到匹配的信息",
				         },  
				         "columnDefs": [{"defaultContent": "",
	                          "targets": "_all"}],
					"columns" : [ {
						"data" : "id",
						"className" : "userId-td hidden-td"
					}, {
						"data" : "name",
						"className" : "name-td"
					}, {
						"data" : "balance",
						"className" : "balance-td"
					}, {
						"data" : "telephone",
						"className" : "telephone-td"
					}, {
						"data" : "lastIp",
						"className" : "lastIp-td"
					}, {
						"data" : "lastTime",
						"className" : "lastTime-td"
					}, {
						"data" : "caozuo"
					}, ],
				})

			function retrieveData(sSource, aoData, fnCallback) {
				$.ajax({
					url : sSource,//这个就是请求地址对应sAjaxSource
					data : {
						"pageCount" : aoData[0].value,
						"startIndex" : aoData[3].value,
						"lineCount" : aoData[4].value,
						"name" : $('#namehuiy').val(),
					},//这个是把datatable的一些基本数据传给后台,比如起始位置,每页显示的行数
					type : 'post',
					dataType : 'json',
					async : false,
					success : function(result) {
						var name = ""
						var newData = result.aaData
						for (var i = 0; i < newData.length; i++) {
							var item = newData[i]
							item['caozuo'] = ""
							var xiangqing = "<button class='btn btn-default btn-edit-UserInfo'>查看下级</button>";
								item.caozuo = xiangqing;
						}
						$('#table-i-userList_wrapper').on('click',".btn-edit-UserInfo",function(event){
								var ids = "";
								ids = $(this).parent().parent().find(".userId-td").text();
								openwin(ids);
						});	
						result.aaData = newData;
						fnCallback(result);//把返回的数据传给这个方法就可以了,datatable会自动绑定数据的
					},
					error : function(msg) {
					}
				});
			}
		})
			
		 function openwin(ids){ 
		   var index = layer.open({
		     type: 2,
		     content: '/agents/gradeDetail.do?ids='+ids,
		     area: ['100%', '100%'],
		   });
        }
		
	</script>
	</body>
</html>


